package com.ssy.lingxi.system.controller;

import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.system.dto.request.CurrencyAddRequest;
import com.ssy.lingxi.system.dto.request.CurrencyDeleteRequest;
import com.ssy.lingxi.system.dto.request.CurrencyListRequest;
import com.ssy.lingxi.system.dto.request.CurrencyUpdateRequest;
import com.ssy.lingxi.system.dto.response.CurrencyListResponse;
import com.ssy.lingxi.system.entity.Currency;
import com.ssy.lingxi.system.service.CurrencyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
 * @menu 基础设置-币制设置管理
 * @author wrc
 * @date 2020/7/20
 */
@Api(tags = "基础设置币制设置管理")
@RestController
public class CurrencyController {

    @Autowired
    CurrencyService currencyService;

    @ApiOperation(value = " 查询币制设置列表")
    @GetMapping("/currency/list")
    public Wrapper<PageData<CurrencyListResponse>> currencyList(CurrencyListRequest request) {
        return currencyService.currencyList(request);
    }


    @ApiOperation(value = " 添加币制设置")
    @PostMapping("/currency/add")
    public Wrapper<Currency> currencyAdd(@RequestBody CurrencyAddRequest request,HttpServletRequest httpServletRequest ) {
        return currencyService.currencyAdd(httpServletRequest,request);
    }

    @ApiOperation(value = "删除币制设置")
    @PostMapping("/currency/delete")
    public Wrapper currencyDelete(@RequestBody CurrencyDeleteRequest request,HttpServletRequest httpServletRequest ) {
        return currencyService.currencyDelete(httpServletRequest,request);
    }

    @ApiOperation(value = "修改币制设置")
    @PostMapping("/currency/update")
    public Wrapper currencyUpdate(@RequestBody CurrencyUpdateRequest request, HttpServletRequest httpServletRequest ) {
        return currencyService.currencyUpdate(httpServletRequest,request);
    }

    @ApiOperation(value = "停用币制设置")
    @PostMapping("/currency/stop")
    public Wrapper currencyStop(@RequestBody CurrencyDeleteRequest request) {
        return currencyService.currencyStop(request);
    }

    @ApiOperation(value = "查询所有币制设置")
    @GetMapping("/currency/all")
    public Wrapper<List<Currency>> currencyAll() {
        return currencyService.currencyAll();
    }


    @ApiOperation(value = "查询币制设置详情")
    @GetMapping("/currency/details")
    public Wrapper<Currency> currencyDetails(CurrencyDeleteRequest request) {
        return currencyService.currencyDetails(request);
    }


}
